<template>

	<view class="index-page with-tabbar">
		<view class="page-content">
			<div class="main-box mt-30">
				<div>
					<div class="ml-30 mr-30">
						<div class="fontS24 color-6d"> 当前账号</div>
						<div class="flex align-end fontS32 font-bold mt-10">{{ userInfo.realName }}
							<span class="fontS26 color-6d ml-20">(ID:{{ userInfo.userId }})</span>
						</div>
						<div class="bg-fff p-20 mt-50 bor-r16">
							<div class="fontS28 font-500">注销账号须知</div>
							<div class="mt-20 fontS24 color-6 lh-40">1.注销账号后，该账号发布岗位，积分信息将无法恢复</div>
							<div class="fontS24 color-6 lh-40">2.注销账号后，该账号不再以企业身份登录，将自动转为牛人账号，以牛人身份登录</div>
						</div>
						<div class="submitBtn mt-100" @click="submitBtn">申请注销</div>
						<div class="cancleBtn mt-20" @click="cancelBtn">取消</div>
					</div>
				</div>

			</div>
		</view>
	</view>
</template>

<script>

import {
	userLogout,
} from "@/api/user";
export default {

	data() {
		return {


		};
	},
	computed: {
		userInfo() {

			return this.$store.getters.userInfo || {};
		},


	},
	async onLoad(options) {


	},

	methods: {
		async submitBtn() {

			uni.showModal({
				content: `您是否确认注销账号？`,
				confirmColor: '#3CC51F', // 确定按钮的文字颜色，默认为"#3CC51F"
				success: async function (res) {
					if (res.confirm) {
						const { data } = await userLogout()
						this.$chat?.logout();
						this.$store.commit("SET_USERINFO", {});
						uni.reLaunch({
							url: '/pages/login/login?type=loginOut'
						})

					} else if (res.cancel) {
						console.log('用户点击了取消按钮');
					}
				}
			})

		},
		cancelBtn() {
			uni.navigateBack({
				delta: 1
			})
		}

	},
};
</script>

<style lang="less" scoped></style>
